<meta charset="utf-8">
<?php
define("DBHOST","localhost:3306");
define("DBUSER","root");
define("DBPASSWORD","root");
define("DBNAME","mydbs2");
$connection=@mysql_connect(DBHOST,DBUSER,DBPASSWORD) or die("数据库连接失败:".mysql_error()."<br/>");
@mysql_query("set names utf8") or die("设计数据库编码格式失败:".mysql_error()."<br/>");
@mysql_select_db(DBNAME) or die("选择数据库失败:".mysql_error()."<br/>");
$createbookstable="create table if not exists books(ISBN varchar(15) primary key,
 name varchar(60),price float,print varchar(60),editor varchar(30),press varchar(45),
 pressdate datetime,contentsinfo varchar(1500),wordnum varchar(30),othersinfos varchar(1200),
 insertdate datetime,state int)";
@mysql_query($createbookstable) or die("创建图书表失败:".mysql_error()."<br>");
$createstudenttable="create table if not exists students(studentno varchar(10) primary key,studentname varchar(60),xingbie varchar(20),number varchar(20),class varchar(30),mobile varchar(20),credit varchar(10),studentinfos varchar(1000))";
@mysql_query($createstudenttable) or die("创建学生信息表失败".mysql_error()."<br/>");
$createpresstable="create table if not exists press(name varchar(45) primary key,
	address varchar(90),youbian varchar(9),email varchar(50),website varchar(50))";
@mysql_query($createpresstable) or die("创建出版社表失败:".mysql_error()."<br/>");
$creatwebsitestable="create table if not exists websites(id int auto_increment primary key,
	name varchar(60),mastername varchar(60),mastermobile varchar(15),masteremail varchar(50),
	websitenum varchar(30),description varchar(450),webkey varchar(150))";
@mysql_query($creatwebsitestable) or die("创建网站信息表失败:".mysql_error()."<br/>");
$createuserinfos="create table if not exists userinfos(id int auto_increment primary key,
	username varchar(45),password varchar(45),email varchar(60),mobile varchar(15))";
@mysql_query($createuserinfos) or die("创建用户信息表失败:".mysql_error()."<br/>");

$selectwebinfos="select name,description,webkey from websites";
$result=@mysql_query($selectwebinfos) or die("查询网站配置信息失败:".mysql_error()."<br/>");
$row=mysql_fetch_array($result,MYSQL_ASSOC);
$mywebtitle=$row["name"];
$mywebdescribe=$row["description"];
$mywebkey=$row["webkey"];
?>
